//
//  DetailViewController.m
//  UISplitViewControllerDemo
//
//  Created by niit on 16/3/10.
//  Copyright © 2016年 NIIT. All rights reserved.
//

#import "DetailViewController.h"
#import "TableViewController.h"

@interface DetailViewController ()

// 弹出控制器
@property (nonatomic,strong) UIPopoverController *popVC;

@end

@implementation DetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.、
    
    // pop内容视图控制器
    UIViewController *popContentVC = [[UIViewController alloc] init];
    popContentVC.view.backgroundColor = [UIColor blueColor];
    
    // 创建弹出控制器
    self.popVC = [[UIPopoverController alloc] initWithContentViewController:popContentVC];
    
    // 弹出的尺寸
    self.popVC.popoverContentSize = CGSizeMake(320, 500);
}


- (IBAction)modelBtnPressed:(id)sender
{
    TableViewController *pVC = [[TableViewController alloc] init];
    self.popVC = [[UIPopoverController alloc] initWithContentViewController:pVC];
    self.popVC.popoverContentSize = CGSizeMake(200, 200);
    if (self.popVC.popoverVisible) {
        [self.popVC dismissPopoverAnimated:YES];
    }
    else
    {
        [self.popVC presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    }
}



- (void)setStuName:(NSString *)stuName
{
    _stuName = stuName;
    
    // 根据情况，将数据显示到界面
    UILabel *label = [self.view viewWithTag:101];
    label.text = stuName;
    NSURL *url = [NSURL URLWithString:stuName];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [self.webView loadRequest:request];

}


@end
